home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / WindowMaker / WINGs / wappresource.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-09  |  2.1 KB  |  106 lines

  1.  
  2.  
  3. #include <unistd.h>
  4.  
  5. #include "WINGsP.h"
  6.  
  7. #include <X11/Xutil.h>
  8.  
  9. /* Xmd.h which is indirectly included by GNUstep.h defines BOOL, 
  10.  * but libPropList also defines it. So we do this kluge to get rid of BOOL
  11.  * temporarily */
  12. #ifdef BOOL
  13. # define WINGS_BOOL
  14. # undef BOOL
  15. #endif
  16.  
  17. #include "GNUstep.h"
  18.  
  19. #ifdef WINGS_BOOL
  20. # define BOOL
  21. # undef WINGS_BOOL
  22. #endif
  23.  
  24.  
  25. extern struct W_Application WMApplication;
  26.  
  27.  
  28. void
  29. WMSetApplicationIconImage(WMScreen *scr, WMPixmap *icon)
  30. {    
  31.     if (scr->applicationIcon)
  32.     WMReleasePixmap(scr->applicationIcon);
  33.     
  34.     scr->applicationIcon = WMRetainPixmap(icon);
  35.     
  36.     if (scr->groupLeader) {
  37.     XWMHints *hints;
  38.  
  39.     hints = XGetWMHints(scr->display, scr->groupLeader);
  40.     hints->flags |= IconPixmapHint|IconMaskHint;
  41.     hints->icon_pixmap = icon->pixmap;
  42.     hints->icon_mask = icon->mask;
  43.     
  44.     XSetWMHints(scr->display, scr->groupLeader, hints);
  45.     XFree(hints);
  46.     }
  47. }
  48.  
  49.  
  50. WMPixmap*
  51. WMGetApplicationIconImage(WMScreen *scr)
  52. {
  53.     return scr->applicationIcon;
  54. }
  55.  
  56.  
  57. void
  58. WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag)
  59. {
  60.     scr->aflags.hasAppIcon = flag;
  61. }
  62.  
  63.  
  64. void
  65. W_InitApplication(WMScreen *scr)
  66. {
  67.     Window leader;
  68.     XClassHint *classHint;
  69.     XWMHints *hints;
  70.  
  71.     leader = XCreateSimpleWindow(scr->display, scr->rootWin, -1, -1,
  72.                  1, 1, 0, 0, 0);
  73.  
  74.     if (!scr->aflags.simpleApplication) {
  75.     classHint = XAllocClassHint();
  76.     classHint->res_name = "groupLeader";
  77.     classHint->res_class = WMApplication.applicationName;
  78.     XSetClassHint(scr->display, leader, classHint);
  79.     XFree(classHint);
  80.  
  81.     XSetCommand(scr->display, leader, WMApplication.argv,
  82.             WMApplication.argc);
  83.  
  84.     hints = XAllocWMHints();
  85.  
  86.     hints->flags = WindowGroupHint;
  87.     hints->window_group = leader;
  88.  
  89.     if (scr->applicationIcon) {
  90.         hints->flags |= IconPixmapHint;
  91.         hints->icon_pixmap = scr->applicationIcon->pixmap;
  92.         if (scr->applicationIcon->mask) {
  93.         hints->flags |= IconMaskHint;
  94.         hints->icon_mask = scr->applicationIcon->mask;
  95.         }
  96.     }
  97.     
  98.     XSetWMHints(scr->display, leader, hints);
  99.  
  100.     XFree(hints);
  101.     }
  102.     scr->groupLeader = leader;
  103. }
  104.  
  105.  
  106.